package com.sjq.servlet;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class BaseServlet extends HttpServlet {
    protected void dispathcher(HttpServletRequest request, HttpServletResponse response,String path)throws ServletException, IOException{
        RequestDispatcher rd=request.getRequestDispatcher(path);
        rd.forward(request,response);
    }
    protected void redirect(HttpServletRequest request,HttpServletResponse response,String url)throws ServletException,IOException{
        String context=request.getContextPath()+"/"+url;
        response.sendRedirect(url);
    }
}
